<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title></title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="/layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="/layuiadmin/style/admin.css" media="all">
</head>
<body>

<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-form layui-card-header layuiadmin-card-header-auto">
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">用户ID</label>
                    <div class="layui-input-block">
                        <input type="text" name="uid" placeholder="请输入" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">状态</label>
                    <div class="layui-input-block">
                        <select name="status" lay-verify="">
                            <option value="">全部</option>
                            <option value="0">未生效</option>
                            <option value="1">已生效</option>
                            <option value="2">已过期</option>
                        </select>
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">结束时间</label>
                    <div class="layui-input-inline" style="width: 210px;">
                        <input type="text" name="end_time" placeholder="结束时间" autocomplete="off" class="layui-input" style="width: 167px;display: inline" id="end_time_input">
                         之后
                    </div>
                </div>
                <div class="layui-inline">
                    <button class="layui-btn layuiadmin-btn-userrec" lay-submit lay-filter="LAY-userrec-front-search">
                        <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
                    </button>
                </div>
            </div>
        </div>
        <div class="layui-card-body">
            <div style="padding-bottom: 10px;">
                <button class="layui-btn layuiadmin-btn-userrec" data-type="add">添加</button>
            </div>

            <table id="LAY-userrec-manage" lay-filter="LAY-userrec-manage"></table>

            <script type="text/html" id="imgTpl">
                <img style="display: inline-block; width: 50%; height: 100%;" src= {{ d.icon }}>
            </script>
            <script type="text/html" id="table-userreclist-operation">
                <a class="layui-btn layui-btn-warm layui-btn-xs" lay-event="opt"><i class="layui-icon"></i>处理</a>
            </script>
        </div>
    </div>
</div>

<script src="/layuiadmin/layui/layui.js"></script>
<script>
    layui.config({
        base: '/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'userrec', 'table', 'laydate'], function(){
        var $ = layui.$
            ,form = layui.form
            ,table = layui.table
            ,laydate = layui.laydate;

        //执行一个laydate实例
        laydate.render({
            elem: '#start_time_input',
            type: 'date'
        });
        laydate.render({
            elem: '#end_time_input',
            type: 'date'
        });

        //监听搜索
        form.on('submit(LAY-userrec-front-search)', function(data){
            var field = data.field;

            //执行重载
            table.reload('LAY-userrec-manage', {
                where: field
            });
        });

        //事件
        var active = {
            add: function(){
                layer.open({
                    type: 2
                    ,title: '添加'
                    ,content: '/admin/userrec/add'
                    ,maxmin: true
                    ,area: ['700px', '600px']
                });
            }
        };

        $('.layui-btn.layuiadmin-btn-userrec').on('click', function(){
            var type = $(this).data('type');
            active[type] ? active[type].call(this) : '';
        });
    });
</script>
</body>
</html>
